## OPERATION ENDURING FREEDOM ##
war_on_terror_category = {

	#Decision to increase intelligence spending
	usa_increase_intelligence_spending = {
	
		visible = {	
			NOT = { has_country_flag = USA_911_happened }
		}
	
		available = {
			custom_trigger_tooltip = {
				tooltip = TT_OEF_SPENDING_REQUIREMENT
				check_variable = { treasury > 0.5 }
			}
		}
		
		cost = 200
		days_remove = 180
		
		modifier = {
			political_power_gain = -2
			democratic_drift = -0.10
		}
		
		complete_effect = {
			custom_effect_tooltip = TT_OEF_SPENDING_MINUS_0.5
			subtract_from_variable = { treasury = 0.5 }
			custom_effect_tooltip = TT_REDUCE_RULING_COALITION_POPULARITY_10_PERCENT
			for_each_loop = {
				array = ruling_party
				value = v
				multiply_variable = { party_pop_array^v = 0.8 }
			}
			for_each_loop = {
				array = gov_coalition_array
				value = v
				multiply_variable = { party_pop_array^v = 0.8 }
			}
			hidden_effect = {	
				recalculate_party = yes
			}
			set_country_flag = USA_increased_intelligence_efforts
			custom_effect_tooltip = TT_OEF_INCREASED_CHANCE_OF_DETECTING_TERRORISTS
		}				
		
	}
	
	#Invasion of Afghanistan storyline
	usa_demand_extradition_of_bin_laden = {
	
		visible = {
			has_country_flag = USA_911_happened
			NOT = { has_country_flag = USA_911_killswitch }
		}
		
		available = {
			custom_trigger_tooltip = {
				tooltip = TT_OEF_WAR_ON_TERROR_SPEECH_HELD
				has_country_flag = war_on_terror_speech
			}
		}
		
		cost = 100
		fire_only_once = yes
		
		complete_effect = {
			TAL = { country_event = { id = wot.9 days = 3 } }
		}
		
		ai_will_do = {
			factor = 10
		}
	}
	usa_operation_enduring_freedom = {
		
		visible = {
			has_country_flag = bin_Laden_stays_home
		}

		available = {
			always = yes
		}
		
		cost = 250

		selectable_mission = yes
		days_remove = 30
		fire_only_once = yes
		
		war_with_on_remove = TAL
		
		remove_effect = {
			set_country_flag = Operation_enduring_freedom
			#Add threat to allow volunteers to be sent
			add_named_threat = {
				threat = 11
				name = USA_enduring_freedom
			}
			#Add strategy to AI to help AFG
			if = {
				limit = { is_ai = yes }
				add_ai_strategy = {
					type = send_volunteers_desire
					id = AFG
					value = 200
				}
				add_ai_strategy = {
					type = befriend
					id = AFG
					value = 200
				}
				add_ai_strategy = {
					type = support
					id = AFG
					value = 200
				}
			}
			PER = {
				add_ai_strategy = {
					type = send_volunteers_desire
					id = AFG
					value = 200
				}
				add_ai_strategy = {
					type = befriend
					id = AFG
					value = 200
				}
				add_ai_strategy = {
					type = support
					id = AFG
					value = 200
				}
			}
			#Other NATO countries + Australia requested to join
			every_other_country = {
				limit = {
					OR = {
						tag = AST
						has_idea = NATO_member
					}
				}
				country_event = { id = wot.12 days = 2 random = 24 }
			}
			#Make sure US is at Global Interventionism idea
			if = {
				limit = { NOT = { has_idea = intervention_global_interventionism } }
				add_ideas = intervention_global_interventionism 
			}
			#If Northern Alliance has been defeated, start a weaker new civil war
			if = {
				limit = { NOT = { country_exists = AFG } }
				clr_global_flag = Afghanistan_Civil_War_Over
				TAL = {
					every_owned_state = {
						limit = { is_core_of = TAL }
						add_core_of = AFG
					}
				}
				AFG = {
					transfer_state = 411
					transfer_state = 410
					set_capital = 411
					declare_war_on = {
						target = TAL
						type = civil_war
					}
					load_oob = "AFG_uprising_by_US"
				}
			}
			hidden_effect = {
				news_event = {
					id = wotnews.7
					hours = 6
				}
			}
		}
		
		ai_will_do = {
			factor = 100
		}
	}
	
	#Homeland Security Act
	usa_homeland_security_act = {
	
		visible = {
			has_country_flag = USA_911_happened
			NOT = { has_idea = USA_homeland_security }
		}
		
		available = {
			NOT = { country_exists = TAL }
		}
		
		cost = 300
		
		fire_only_once = yes
		
		complete_effect = {
			add_ideas = USA_homeland_security
		}
		
		ai_will_do = {
			factor = 10
		}
	}
	
	#Setting up a new administration in Afghanistan
	usa_setup_new_administration_in_afghanistan = {
		
		visible = {
			has_country_flag = Operation_enduring_freedom
		}
		
		available = {
			NOT = { country_exists = TAL }
		}
		
		cost = 150
		
		fire_only_once = yes
		
		complete_effect = {
			country_event = { id = wot.13 }
		}
		
		ai_will_do = {
			factor = 10
		}
	}
	
	#Create Guantanamo Bay
	usa_create_guantanamo_bay = {
	
		visible = {
			has_country_flag = Operation_enduring_freedom
			NOT = { has_idea = USA_guantanamo_bay }
		}
		
		available = {
			OR = {
				NOT = { country_exists = TAL }
				AFG = { has_volunteers_amount_from = { tag = USA count > 0 } }
			}
		}
		
		cost = 200
		
		fire_only_once = yes
		
		complete_effect = {
			add_ideas = USA_guantanamo_bay
			set_country_flag = guantanamo_bay_detention_center_established
			CUB = {
				add_opinion_modifier = {
					target = USA
				modifier = territorial_violation
				}
			}
			hidden_effect = {
				news_event = { id = wotnews.9 hours = 6 }
			}
		}
		
		ai_will_do = {
			factor = 10
		}
	}
	
	#Petition Operation Iraqi Freedom
	usa_petition_invasion_of_iraq = {
	
		visible = {
			has_country_flag = Operation_enduring_freedom
			IRQ = { has_country_leader = { name = "Saddam Hussein" ruling_only = yes } }
		}
		
		available = {
			NOT = { country_exists = TAL }
		}
		
		cost = 200
		
		fire_only_once = yes
		
		complete_effect = {
			ENG = { country_event = { id = wot.14 days = 5 random = 72 } }
			CHI = { country_event = { id = wot.14 days = 5 random = 72 } }
			SOV = { country_event = { id = wot.14 days = 5 random = 72 } }
			FRA = { country_event = { id = wot.14 days = 5 random = 72 } }
			set_country_flag = US_UN_vote_on_iraq
		}
		
		ai_will_do = {
			factor = 100
		}
	}
	
	#Run a war support campaign for Iraq
	usa_run_war_support_campaign_against_iraq = {
	
		visible = {
			has_country_flag = us_prepare_for_iraq_invasion
			NOT = { has_country_flag = Operation_iraqi_freedom }
		}
		
		available = {
			has_war = no
		}
		
		cost = 200
		
		selectable_mission = yes
		days_remove = 180
		
		modifier = {
			political_power_gain = -2
			war_support_weekly = 0.005
		}
		
		complete_effect = {
		}
		
		ai_will_do = {
			factor = 10
		}
	}		
	
	#Operation iraqi freedom
	usa_operation_iraqi_freedom = {
	
		visible = {
			has_country_flag = us_prepare_for_iraq_invasion
		}
		
		available = {
			has_war_support > 0.75
		}
		
		cost = 150

		selectable_mission = yes
		days_remove = 90
		fire_only_once = yes
		
		war_with_on_remove = IRQ
		
		remove_effect = {
			set_country_flag = Operation_iraqi_freedom
			#Add threat to allow volunteers to be sent
			add_named_threat = {
				threat = 11
				name = USA_iraqi_freedom
			}
			create_wargoal = {
				target = IRQ
				type = puppet_wargoal_focus
			}
			hidden_effect = { news_event = { id = wotnews.11 hours = 6 } }
		}
			
		complete_effect = {
			KUR = {
				add_ai_strategy = {
					type = conquer
					id = "IRQ"
					value = 200
				}
			}
			set_country_flag = us_preparing_invasion_of_iraq
			every_other_country = {
				limit = {
					OR = {
						has_idea = NATO_member
						original_tag = AST
					}
				}
				country_event = { id = wot.17 days = 5 random = 72 }
			}
		}
		
		ai_will_do = {
			factor = 100
		}
	}
	
	#Withdraw troops from iraq
	usa_withdraw_troops_from_iraq = {
	
		visible = {
			date > 2012.1.1
			IRQ = { is_subject_of = USA }
			has_global_flag = success_of_operation_iraqi_freedom
		}
		
		available = {
			IRQ = { has_war = no }
		}

		cost = 200
		
		fire_only_once = yes
		
		complete_effect = {
			end_puppet = IRQ
			remove_from_faction = IRQ
			hidden_effect = { news_event = { id = wotnews.14 hours = 6 } }
		}
		
		ai_will_do = {
			factor = 10
		}
	}		
		
	usa_intervene_SYR = {
		allowed = { tag = USA }

		available = {
			or = {
				SYR = { has_volunteers_amount_from = { tag = USA count > 0 } }
				FSA = { has_volunteers_amount_from = { tag = USA count > 0 } }
				NUS = { has_volunteers_amount_from = { tag = USA count > 0 } }
				ISI = { has_volunteers_amount_from = { tag = USA count > 0 } }
				ROJ = { has_volunteers_amount_from = { tag = USA count > 0 } }
			}
			
		}


		activation = {
			SYR = {
				or = {
					has_war_with = ISI
					has_war_with = FSA
					has_war_with = NUS
					has_war_with = ROJ
				}
			}
		}


		Is_good = no

		selectable_mission = yes
		days_mission_timeout = 60
		days_remove = 3
		

		fire_only_once = yes


		timeout_effect = {
			add_political_power = -25
		}


		complete_effect = {
			add_political_power = 25
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	
	usa_intervene_YEM = {
		allowed = { tag = USA }

		available = {
			or = {
				YEM = { has_volunteers_amount_from = { tag = USA count > 0 } }
				HOU = { has_volunteers_amount_from = { tag = USA count > 0 } }
				
			}
		}

		activation = {
			YEM = {
				or = {
					has_war_with = HOU
				}
			}
		}


		Is_good = no

		selectable_mission = yes
		days_mission_timeout = 60
		days_remove = 3
		

		fire_only_once = yes


		timeout_effect = {
			add_political_power = -25
		}


		complete_effect = {
			add_political_power = 25
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	usa_intervene_AFG = {
		allowed = { tag = USA }

		available = {
			or = {
				AFG = { has_volunteers_amount_from = { tag = USA count > 0 } }
				TAL = { has_volunteers_amount_from = { tag = USA count > 0 } }

			}
		}

		activation = {
			date > 2014.12.28
			AFG = {
				or = {
					has_war_with = TAL
				}
			}
		}


		Is_good = no

		selectable_mission = yes
		days_mission_timeout = 60
		days_remove = 3
		

		fire_only_once = yes


		timeout_effect = {
			add_political_power = -25
		}


		complete_effect = {
			add_political_power = 25
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	usa_intervene_SOM = {
		allowed = { tag = USA }

		available = {
			or = {
				SOM = { has_volunteers_amount_from = { tag = USA count > 0 } }
				SHB = { has_volunteers_amount_from = { tag = USA count > 0 } }
				
			}
		}

		activation = {
			SOM = {
				or = {
					has_war_with = SHB
				}
			}
		}


		Is_good = no

		selectable_mission = yes
		days_mission_timeout = 60
		days_remove = 3
		

		fire_only_once = yes


		timeout_effect = {
			add_political_power = -25
		}
		

		complete_effect = {
			add_political_power = 25
		}
		
		ai_will_do = {
			factor = 1
		}
	}
	usa_intervene_GNA = {
		allowed = { tag = USA }


		available = {
			or = {
				GNA = { has_volunteers_amount_from = { tag = USA count > 0 } }
				HOR = { has_volunteers_amount_from = { tag = USA count > 0 } }
				TUA = { has_volunteers_amount_from = { tag = USA count > 0 } }
				
			}
		}

		activation = {
			GNA = {
				or = {
					has_war_with = HOR
					has_war_with = TUA
				}
			}
		}
		

		Is_good = no

		selectable_mission = yes
		days_mission_timeout = 60
		days_remove = 3
		

		fire_only_once = yes
		
		timeout_effect = {
			add_political_power = -25
		}
		
		complete_effect = {
			add_political_power = 25
		}
		
		ai_will_do = {
			factor = 1
		}
	}
}